# -*- coding: utf-8 -*-
'''
# @Datetime: 2018/12/23
# @author: Zhang Yafei
'''


class Foo(object):
    def __init__(self):
        object.__setattr__(self, 'storage', {})   # 当我们想绕过当前类的setattr方法，可以执行object.__setter__
        # self.storage = {}   # AttributeError: 'Foo' object has no attribute 'storage

    def __setattr__(self, key, value):
        print(key, value, self.storage)


obj = Foo()
obj.xx = 123
